package util;

import java.util.Random;

public final class TestTools 
{
	public static final int     TEST_RUNS      = 10;
	public static final int     TEST_DATA_SIZE = 50000000;
	private static final Random RAND           = new Random();
	
	private TestTools(){ }
	
	
	public static int[] createTestData()
	{
		final int[] data = new int[TEST_DATA_SIZE];
		
		for(int i = data.length - 1; i > -1; i--)
		{
			data[i] = RAND.nextInt();
		}
		
		return data;
	}
	
	public static int[] createForwardSequentialAccessIndexArray()
	{
		return createForwardSequentialAccessIndexArray(TEST_DATA_SIZE);
	}

	
	public static int[] createForwardSequentialAccessIndexArray(final int dataSize)
	{
		final int[] data = new int[dataSize];
		for(int i = 0; i < dataSize; i++)
		{
			data[i] = i;
		}
		
		return data;
	}
	
	
	
	public static int[] createBackwardSequentialAccessIndexArray()
	{
		final int[] data = new int[TEST_DATA_SIZE];
		for(int i = TEST_DATA_SIZE - 1; i > -1; i--)
		{
			data[i] = i;
		}
		
		return data;
	}
	
	public static int[] createRandomAccessIndexArray()
	{
		return createRandomAccessIndexArray(TEST_DATA_SIZE);
	}
	
	public static int[] createRandomAccessIndexArray(final int dataSize)
	{
		final int[] data = new int[dataSize];
		for(int i = 0; i < dataSize; i++)
		{
			data[i] = RAND.nextInt(TEST_DATA_SIZE);
		}
		
		return data;
	}
}
